<template>
    <div class="app-container">
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        <div class="filter-container add1">
    
    
    
            <el-form style="">
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                <el-form-item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <!-- 按钮级别的控制,使用hasPerm来判断是否应该有添加这个按钮 -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <el-button type="primary" icon="plus" @click="showCreate" v-if="hasPerm('order:add')">添加
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    </el-button>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <!-- 下载模板 -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <el-button @click="exportExcel" type="primary" icon="plus" v-if="hasPerm('order:add')">下载导入模板
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    </el-button>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <!-- 使用后端导入 -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <el-button type="primary" icon="plus" v-if="hasPerm('order:add')" size="small">导入
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                        <input type="file" id="btn" ref="clearFile" name="file" @change="importf(this)" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    </el-button>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <el-button @click="exportExcelOpertor" type="primary" icon="plus" v-if="hasPerm('order:add')">导出</el-button>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                    <el-button @click="showDisplay" type="primary" icon="plus">显示字段</el-button>
    
                    <el-button type="danger" v-if="multipleSelectionFlag" @click="delSelect">
    
                        批量删除
   
                    </el-button>
    
                </el-form-item>
    
            </el-form>
   
        </div>

        <div class="searchWord">
   
            <el-input v-model="search" placeholder="请输入搜索内容" @input="inputFunction()">
    
            </el-input>
    
        </div>
    
        <br>

        <el-table class="tabless" :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row :row-class-name="tableRowClassName" @sort-change='sortChange' @selection-change="handleSelectionChange">
    
            <el-table-column type="selection" width="55" v-if="displayAttribute.select" fixed>
    
            </el-table-column>
    
            <el-table-column align="center" label="序号" width="80" v-if="displayAttribute.id" fixed>
    
                <template slot-scope="scope">

                          <!-- 订单信息的索引 -->
                          <span v-text="getIndex(scope.$index)"> </span>
                          <!-- 订单信息的id -->
    
                          <!-- <span v-text="scope.row.id"> </span> -->
</template>
      </el-table-column>
      <el-table-column align="center" prop="order_id" label="订单编号" width="100" v-if="displayAttribute.order_id"></el-table-column>
      <el-table-column align="center" prop="create_time" label="订单日期" width="150" v-if="displayAttribute.create_time"></el-table-column>
      <el-table-column align="center" prop="client_name" label="客户姓名" width="100" v-if="displayAttribute.client_name"></el-table-column>
      <el-table-column align="center" prop="manager_name" label="导师/负责人姓名" width="150" v-if="displayAttribute.manager_name"></el-table-column>
      <el-table-column align="center" prop="client_affiliation" label="客户单位" width="300" v-if="displayAttribute.client_affiliation"></el-table-column>
      <el-table-column align="center" prop="shipping_address" label="送货地址" width="300" v-if="displayAttribute.shipping_address"></el-table-column>
      <el-table-column align="center" prop="invoice_title" label="发票抬头" width="300" v-if="displayAttribute.invoice_title"></el-table-column>
      <el-table-column align="center" prop="form_of_invoice" label="开票形式" width="200" v-if="displayAttribute.form_of_invoice"></el-table-column>
      <el-table-column align="center" prop="telephone" label="电话" width="300" v-if="displayAttribute.telephone"></el-table-column>
      <el-table-column align="center" prop="client_phone" label="手机" width="300" v-if="displayAttribute.client_phone"></el-table-column>
      <el-table-column align="center" prop="client_email" label="email" width="300" v-if="displayAttribute.client_email"></el-table-column>
      <el-table-column align="center" prop="notification_of_delivery" label="发货通知方式" width="300" v-if="displayAttribute.notification_of_delivery"></el-table-column>
<<<<<<< HEAD
=======
      <el-table-column align="center" prop="orderStatus" label="订单状态" width="300" v-if="displayAttribute.orderStatus" fixed="right"></el-table-column>
>>>>>>> develop
        <!--<template slot-scope="scope">
    <span>{{scope.row.createTime}}</span>
</template>-->
      </el-table-column>

      <el-table-column align="center" label="管理" width="550" v-if="hasPerm('order:update') & displayAttribute.manageMent" fixed="right">
<template slot-scope="scope">
    <!-- {{list[scope.$index].orderStatus}} -->
<<<<<<< HEAD
    <el-button type="primary" icon="edit" @click="showDetails(scope.$index)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '审核不通过' || list[scope.$index].orderStatus == '待出库' || list[scope.$index].orderStatus == '待设计' || list[scope.$index].orderStatus == '待生产'">
    
        详情
    
    </el-button>
    
    <el-button type="primary" @click="designOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '待出库'">设计</el-button>
    
    <el-button type="primary" @click="productOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '待出库' || list[scope.$index].orderStatus == '待设计'">生产</el-button>
    
    <el-button type="primary" @click="outOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '待设计' || list[scope.$index].orderStatus == '待生产'">出库</el-button>
    
    <el-button type="primary" @click="checkSaleOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '待审核'">审核订单</el-button>

    <el-button type="primary" icon="edit" @click="showUpdate(scope.$index)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '审核不通过'">修改</el-button>
    
    <el-button type="danger" @click="handleDelete(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '审核不通过' || list[scope.$index].orderStatus == '待出库' || list[scope.$index].orderStatus == '待设计' || list[scope.$index].orderStatus == '待生产'">删除</el-button>
=======
    <el-button size="mini" type="primary" icon="edit" @click="showDetails(scope.$index)" >详情</el-button>

    <el-button size="mini"  type="primary" @click="checkSaleOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '待审核'" >审核订单</el-button>
    
    <el-button size="mini"  type="primary" @click="designOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过'">设计</el-button>
    
    <el-button size="mini"  type="primary" @click="productOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '设计完成' || list[scope.$index].orderStatus == '审核通过'">生产</el-button>
    
    <el-button size="mini"  type="primary" @click="outOrders(scope.$index, scope.row)" v-if="list[scope.$index].orderStatus == '审核通过' || list[scope.$index].orderStatus == '待设计' || list[scope.$index].orderStatus == '设计中'|| list[scope.$index].orderStatus == '设计取消'|| list[scope.$index].orderStatus == '设计完成' || list[scope.$index].orderStatus == '待生产'|| list[scope.$index].orderStatus == '生产中'|| list[scope.$index].orderStatus == '生产取消'|| list[scope.$index].orderStatus == '生产完成'">出库</el-button>
    

    <el-button size="mini"  type="primary" icon="edit" @click="showUpdate(scope.$index)" >修改</el-button>
    
    <el-button size="mini"  type="danger" @click="handleDelete(scope.$index, scope.row)" >删除</el-button>
>>>>>>> develop
    
</template>
      </el-table-column>
    </el-table>

    <el-dialog :visible.sync="dialogProjectFormVisible" width="70%">
      <transition name="fade" mode="out-in">
        <!-- <router-view :key="key"></router-view> -->
        <router-view></router-view>
        
      </transition>
      
      <span slot="footer">
        <!-- dialogProjectFormVisible = false -->
        <el-button @click="cancelDialog">取 消</el-button>
      </span>
    </el-dialog>

    <!-- 删除提示框 -->
        <el-dialog title="提示" :visible.sync="delVisible" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delVisible = false">取 消</el-button>
                <el-button type="primary" @click="deleteRow" >确 定</el-button>
            </span>
        </el-dialog>

        <!-- 删除提示框 -->
        <el-dialog title="提示" :visible.sync="delVisibleByBatch" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定批量删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delVisibleByBatch = false">取 消</el-button>
                <el-button type="primary" @click="delAll" >确 定</el-button>
            </span>
        </el-dialog>
    
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="listQuery.pageNum" 
      :page-size="listQuery.pageRow"
      :total="totalCount"
      :page-sizes="[3, 20, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      class="pagination">
    </el-pagination>

    
    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
      <el-form class="small-space" :model="tempOrder" label-order="left" label-width="150px"
               style='width:600px; margin-left:60px;'>
<<<<<<< HEAD
        
        <el-form-item label="订单类型" v-if="dialogStatus=='create'">
          <el-select v-model="label" filterable placeholder="请选择" @change = "handlerOrderType">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
=======

        <el-form-item label="订单类型" v-if="dialogStatus=='create'">
          <el-select v-model="lable_type" filterable placeholder="请选择" @change = "handlerOrderType">
            <el-option v-for="item in options" :key="item.value" :label="item.lable_type" :value="item.value">
>>>>>>> develop
            </el-option>
          </el-select>
        </el-form-item>


        <div v-if="dialogStatus=='dispalyAtt'">
          <el-checkbox v-model="displayAttribute.select" disabled>复选框</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.id" disabled>序号</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.order_id" disabled>订单编号</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.create_time" disabled>订单日期</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.client_name" disabled>客户姓名</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.manager_name">导师/负责人姓名</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.client_affiliation" disabled>客户单位</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.shipping_address">送货地址</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.invoice_title">发票抬头</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.form_of_invoice">开票形式</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.telephone">电话</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.client_phone">手机</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.client_email">email</el-checkbox><br>
          <el-checkbox v-model="displayAttribute.notification_of_delivery">发货通知方式</el-checkbox><br>

        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
<<<<<<< HEAD
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button v-if="dialogStatus=='create'" type="success" @click="createOrder" :disabled = "enableCreate">确定选择</el-button>
        <el-button type="primary" v-if="dialogStatus=='update'" @click="updateCompany" :disabled = "enableUpdate">修 改</el-button>
=======
        <el-button @click="cancelCreateDialog">取 消</el-button>
        <el-button v-if="dialogStatus=='create'" type="success" @click="createOrder" :disabled = "enableCreate">确定选择</el-button>
        <el-button v-if="dialogStatus=='update'" type="primary" @click="updateOrder" :disabled = "enableUpdate">修 改</el-button>
>>>>>>> develop
        
      </div>
    </el-dialog>


    <el-dialog
      :title="textMap[dialogStatus]"
      :visible.sync="dialogFormVisible3"
      width="30%"
      >
      <el-radio v-model="radio2" label="1">同意</el-radio>
      <el-radio v-model="radio2" label="2">拒绝</el-radio>
      <br><br>
      理由：
      <el-input
        type="textarea"
        :rows="3"
        placeholder="请输入审核理由"
        v-model="textarea2">
      </el-input>

      <span slot="footer">
        <el-button @click="dialogFormVisible3 = false">取 消</el-button>
        <el-button type="primary" @click="checkSub">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog
      :title="textMap[dialogStatus]"
      :visible.sync="dialogFormVisible4"
      width="30%"
      @close="dialogFormVisible4 = false">
      您确定出库?
      <span slot="footer">
        <el-button @click="dialogFormVisible4 = false">取 消</el-button>
        <el-button type="primary" @click="exwarehouse">确 定</el-button>
      </span>
    </el-dialog>
    
    <el-dialog
        :title="textMap[dialogStatus]"
        :visible.sync="dialogFormVisible5"
        width="30%"
        @close="dialogFormVisible5 = false">
        部门：<el-select v-model="temp_design_out.design_major_dept" placeholder="请选择部门设计产品">
            <el-option
              v-for="item in departmentList"
              :key="item.department_id"
              :label="item.department_name"
              :value="item.department_id">
            </el-option>
        </el-select>
        <span slot="footer">
            <el-button @click="dialogFormVisible5 = false">取 消</el-button>
            <el-button type="primary" @click="designOut">确 定</el-button>
        </span>
    </el-dialog>
    
    <el-dialog
        :title="textMap[dialogStatus]"
        :visible.sync="dialogFormVisible6"
        width="30%"
        @close="dialogFormVisible5 = false">
        部门：<el-select v-model="temp_product_out.product_major_dept_id" placeholder="请选择部门生产产品">
            <el-option
              v-for="item in departmentList"
              :key="item.department_id"
              :label="item.department_name"
              :value="item.department_id">
            </el-option>
        </el-select>
        <br>
        <br>
        类型：
        <el-select v-model="temp_product_out.product_type" placeholder="请选择">
            <el-option
              v-for="item in productTypes"
              :key="item.value"
            :label="item.label"
            :value="item.value">
            </el-option>
        </el-select>
        <span slot="footer">
            <el-button @click="dialogFormVisible6 = false">取 消</el-button>
            <el-button type="primary" @click="productOut">确 定</el-button>
        </span>
    </el-dialog>
    
  </div>
</template>
<script>
import FileSaver from "file-saver";
import XLSX from "xlsx";
import { mapGetters } from 'vuex';
export default {
    data() {
        return {
            readonly: false,
            totalCount: 0, //分页组件--数据总条数
            list: [], //表格的数据
            listLoading: false, //数据加载等待动画
            listQuery: {
                pageNum: 1, //页码
                pageRow: 3, //每页条数
                name: ''
            },
            // 为textMap中的属性,指定标题头
            dialogStatus: 'create',
            dialogFormVisible: false,
            dialogFormVisible2: false,
            dialogFormVisible3: false,
            dialogFormVisible4: false,
            dialogFormVisible5: false,
            dialogFormVisible6: false,
            radio2: '1',
            textarea2: '',
            textMap: {
                update: '修改订单信息',
                create: '添加订单选择产品',
                detail: '订单详细信息',
                dispalyAtt: '显示字段',
                check: '审核',
                out: '出库订单',
                product: '生产订单',
                design: '设计订单',
            },

            dialogProjectFormVisible: false,
            departmentList: [], 
<<<<<<< HEAD
            options: [{
                value1: '选项1',
                label1: 'RNA oligo'
            }, {
                value1: '选项2',
                label1: '试剂盒&引物探针套装'
            }, {
                value1: '选项3',
                label1: '载体'
            }, {
                value1: '选项4',
                label1: '探针合成'
            }, {
                value1: '选项5',
                label1: 'FISH试剂盒&其他'
            }, {
                value1: '选项6',
                label1: '病毒'
            }, {
                value1: '选项7',
                label1: '全基因'
            }],
=======

            options: [{
                value: '选项1',
                lable_type: 'RNA oligo'
            }, {
                value: '选项2',
                lable_type: '试剂盒&引物探针套装'
            }, {
                value: '选项3',
                lable_type: '载体'
            }, {
                value: '选项4',
                lable_type: '探针合成'
            }, {
                value: '选项5',
                lable_type: 'FISH试剂盒&其他'
            }, {
                value: '选项6',
                lable_type: '病毒'
            }, {
                value: '选项7',
                lable_type: '全基因'
            }],
            lable_type: '',

>>>>>>> develop
            productTypes: [{
                value: '单链',
                label: '单链'
                }, {
                value: '双链',
                label: '双链'
                }, {
                value: '其它',
                label: '其它'
                }],
            label: '',
            designDept:'',
            productDept:'',
            tempOrder: {
                id: "",
                order_id: "",
                mord_id: "",
                create_time: "",
                client_name: "",
                manager_name: "",
                client_affiliation: "",
                shipping_address: "",
                invoice_title: "",
                form_of_invoice: "",
                telephone: "",
                client_phone: "",
                client_email: "",
                notification_of_delivery: "",
                radio2: "",
                textarea2: "",
                orderType: "",
<<<<<<< HEAD

=======
                sc_item_id : "",
                item_nunmbers : "",
                item_unit : "",
>>>>>>> develop
                gene_name:"",//基因名称 gene_name
                specifications:"",//规格 synthetic_specification
                div_tubes_number : "",//分装管数 num_divided_tubes
                sense_53 : "",//sense53 sense
                antisense_53 : "", //antisense_53 antisense
                chemical_modification : "",//化学修饰 chemical_modification
                special_modi : "",//特殊修饰 special_modification
                flu_labeling : "" , //荧光标记 fluorescent_labeling
                special_instructions : "", // 特殊说明 special_instructions
            },
            temp_warehouse_out: {
                // exwarehouse_mord_id : "",
                exwarehouse_son_order_id: "",
                type: "",
                status: "",
                saling_mord_id: "",
                saling_son_order_id: "",
                storage_put_num_ought: "",
                storage_put_num: "",
                application_staff_id: "",
                product_name: "",
            },
            temp_product_out: {
                sales_mord_id : "",
                saling_son_order_id : "",
                product_type : "",
                status : "",
                gene_name:"",//基因名称 gene_name
                specifications:"",//规格 synthetic_specification
                div_tubes_number : "",//分装管数 num_divided_tubes
                sense_53 : "",//sense53 sense
                antisense_53 : "", //antisense_53 antisense
                chemical_modification : "",//化学修饰 chemical_modification
                special_modi : "",//特殊修饰 special_modification
                flu_labeling : "" , //荧光标记 fluorescent_labeling
                special_instructions : "", // 特殊说明 special_instructions
                create_staff_id : "",
                product_major_dept_id : "",
<<<<<<< HEAD
=======
                item_nunmbers : "",
                item_unit : ""
>>>>>>> develop
            },
            temp_design_out :{
                status : "",
                sales_mord_id : "",
                saling_son_order_id : "",
                create_staff_id : "",
                design_major_dept : "",
            },
            delVisible: false, //删除提示弹框的状态
            delVisibleByBatch: false, //批量删除提示弹框的状态
            msg: "", //记录每一条的信息，便于取id
            delarr: [], //存放删除的数据
            multipleSelection: [], //多选的数据
            // 搜索框中的内容
            search: '',
            // 排序的列名
            prop: '',
            // 排序的方式:包括asc,desc等
            order: '',
            // 记录导出得时候跳页的之前的页数
            temp_page: 3,

            enableCreate: true,
            enableUpdate: false,

            multipleSelectionFlag: true,
            // 记录显示字段
            displayAttribute: {
                select: true,
                id: true,
                order_id: true,
                mord_id: true,
                create_time: true,
                client_name: true,
                manager_name: true,
                client_affiliation: true,
                shipping_address: true,
                invoice_title: true,
                form_of_invoice: true,
                telephone: true,
                client_phone: true,
                client_email: true,
                notification_of_delivery: true,
<<<<<<< HEAD
                manageMent: true
=======
                manageMent: true,
                orderStatus : true
>>>>>>> develop
            }
        }
    },

    created() {
        if (this.hasPerm('order:list')) {
            this.getList();
        }
        
        if (this.hasPerm('department:list')) {
            this.getAllDepartments();
        }
        // this.showUserInfo();
    },
    computed: {
        ...mapGetters([
<<<<<<< HEAD
            'userId',
            'nickname'
=======
            'order_id',
            'orderOperate'
>>>>>>> develop
        ])
    },
    methods: {

<<<<<<< HEAD
=======
        cancelCreateDialog(){
            this.dialogFormVisible = false;
            this.getList()
        },

>>>>>>> develop
        cancelDialog() {
            this.dialogProjectFormVisible = false;
            this.getList()
        },

        clearFile() {
            this.$refs.clearFile.value = ''; // 清空file文件
        },
        // 导入
        importf(obj) {
            let _this = this;
            let inputDOM = this.$refs.inputer; // 通过DOM取文件数据
            this.file = event.currentTarget.files[0];
            var rABS = false; //是否将文件读取为二进制字符串
            var f = this.file;
            var reader = new FileReader();
            //if (!FileReader.prototype.readAsBinaryString) {
            FileReader.prototype.readAsBinaryString = function(f) {
                var binary = "";
                var rABS = false; //是否将文件读取为二进制字符串
                var pt = this;
                var wb; //读取完成的数据
                var outdata;
                var reader = new FileReader();
                reader.onload = function(e) {
                    var bytes = new Uint8Array(reader.result);
                    var length = bytes.byteLength;
                    for (var i = 0; i < length; i++) {
                        binary += String.fromCharCode(bytes[i]);
                    }
                    var XLSX = require('xlsx');
                    if (rABS) {
                        wb = XLSX.read(btoa(fixdata(binary)), { //手动转化
                            type: 'base64'
                        });
                    } else {
                        wb = XLSX.read(binary, {
                            type: 'binary'
                        });
                    }
                    // outdata就是你想要的东西 excel导入的数据
                    outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
                    // excel 数据再处理
                    let arr = []
                    outdata.map(v => {
                        // console.log(v)
                        let obj = {}
<<<<<<< HEAD

=======
>>>>>>> develop
                        obj.order_id = v.子订单编号
                        obj.mord_id = v.父订单编号
                        obj.create_time = v.订单日期
                        obj.client_name = v.客户姓名
                        obj.manager_name = v.导师管家姓名
                        obj.client_affiliation = v.客户单位
                        obj.shipping_address = v.送货地址
                        obj.invoice_title = v.发票抬头
                        obj.form_of_invoice = v.开票形式
                        obj.telephone = v.电话
                        obj.client_phone = v.手机
                        obj.client_email = v.电子邮件
                        obj.notification_of_delivery = v.发货通知方式

                        arr.push(obj)
                        _this.tempOrder = obj
                        _this.createOrder()
                        // this.api({
                        //   url: "/article/addArticle",
                        //   method: "post",
                        //   data: obj
                        // }).then(() => {
                        //   this.getList();
                        //   // this.dialogFormVisible = false
                        // })
                    })
                    _this.accountList = [...arr];
                    // _this.reload();
                    // console.log('uuuuuuuuuuuuuuuuuuuuu');
                }
                alert("上传完毕！")
                _this.clearFile()
                reader.readAsArrayBuffer(f);
            }
            if (rABS) {
                reader.readAsArrayBuffer(f);
            } else {
                reader.readAsBinaryString(f);
            }
        },

        // 导入结束
        exportExcelOpertor() {
            // let tempPageSize = this.listQuery.pageRow;
            // alert(tempPageSize);
            // this.exportExcel();
            this.temp_page = this.listQuery.pageRow;
            // this.listQuery.pageRow = this.totalCount;
            this.handleSizeChange(this.totalCount)
            // this.listQuery.pageRow = this.totalCount;
            // alert("1")
            // this.exportExcel();


            // alert("2")
            // this.exportExcel();
            window.setTimeout(this.exportExcel, 50);
            // alert("3")
            // window.setTimeout("")
            window.setTimeout(this.delayTime, 200);
        },
        delayTime() {
            this.listQuery.pageRow = this.temp_page
            this.generalFun();
        },

        exportExcel() {
            // alert("exportExcel")
            // 设置当前日期
            let time = new Date();
            let year = time.getFullYear();
            let month = time.getMonth() + 1;
            let day = time.getDate();
            let name = year + "" + month + "" + day;
            // alert(this.totalCount);

            // alert(this.listQuery.pageRow);
            // this.listQuery.pageNum = 1;
            // this.getList();
            // alert("zandaoguang");
            // return
            this.$nextTick(function() {
                // alert("iiiiiiiiiiiiiiiii");
                // alert(tempPageSize);
                let wb = XLSX.utils.table_to_book(document.querySelector('.tabless'));
                /* get binary string as output */
                let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
                try {
                    FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), name + ".xlsx")
                } catch (e) {
                    if (typeof console !== 'undefined') console.log(e, wbout)
                }
                // this.listQuery.pageRow = 3;//表格还原
                // this.getList();
                return wbout
            })
        },


        inputFunction() {
            // console.log(this.search);
            // console.log(this.search == "");

            if (this.search) {
                // console.log('aaaaaaaaaaaaaaaa');
                this.getListBySearch(this.search);
            }
            if (this.search == "") {
                this.getList();
            }
        },
        sortChange(column, prop, order) {
            // this.handleCurrentChange(1);
            this.listQuery.pageNum = 1;         // 点击排序按钮后拿到column.order，可以发送column.order给后台，后台再根据什么排序来返回排序过后的数据
            // console.log(column);
                     // console.log(column + '---' + column.prop + '---' + column.order)
            // this.prop = column.prop;
            // this.order = column.order;
            // console.log(this.prop);
            // console.log(column.prop);
            // console.log(this.order);
            // 如果搜索框中没有搜索内容
            if (this.search == "") {
                if (column.order === "descending") {
                    this.listQuery.sortby = column.prop;
                    this.listQuery.order = 'DESC';
                    // this.prop = column.prop;
                    // this.order = 'DESC';
                } else {
                    this.listQuery.sortby = column.prop;
                    this.listQuery.order = 'ASC';
                    // this.prop = column.prop;
                    // this.order = 'ASC';
                }
                if (column.prop == "content") {
                    this.getListByOrderContent();
                    // this.prop = '';
                    // this.order = '';
                } else if (column.prop == "createTime") {
                    this.getListByOrderCreateTime();
                    // this.prop = '';
                    // this.order = '';
                } else {
                    // 默认返回id排序
                    this.getList();
                }
            }
            // 如果搜索框中有搜索内容
            else {
                if (column.order === "descending") {
                    this.listQuery.sortby = column.prop;
                    this.listQuery.order = 'DESC';
                    // this.prop = column.prop;
                    // this.order = 'DESC';
                } else {
                    this.listQuery.sortby = column.prop;
                    this.listQuery.order = 'ASC';
                    // this.prop = column.prop;
                    // this.order = 'ASC';
                }
                if (column.prop == "content") {
                    this.getListByContentHaveSearch();
                    // this.prop = '';
                    // this.order = '';
                } else if (column.prop == "createTime") {
                    // 当空格的时候，应该怎么排序
                    // this.getListByOrderCreateTime();
                    // 默认按照id排序
                    // this.getListBySearch(this.search);
                    this.getListByOrderCreateTimeHaveSearch();
                    // this.prop = '';
                    // this.order = '';
                } else {
                    // 默认什么都不做
                    // 默认返回id排序
                    this.getListBySearch(this.search);
<<<<<<< HEAD
                }
            }       //输出的结果 [object Object]---name---ascending
                  
        },
        handleDelete(index, row) {
            this.idx = index;
            this.msg = row; //每一条数据的记录
            this.delarr.push(this.msg.PackingId); //把单行删除的每条数据的id添加进放删除数据的数组
            this.delVisible = true;
        },
        // 当批量删除的时候,如果要是没有选中,弹出提醒
        delWarnInfo() {
            this.$message('请选择您要删除的数据');
        },
        deleteRow() {
            let _vue = this;
            // 写自己的删除的对象
            // console.log(this.delarr)
            let company = _vue.list[_vue.idx];
            _vue.api({
                url: "/company/deleteCompany",
                method: "post",
                data: company
            }).then(() => {
                if (this.search == "") {
=======
                  }
              }
              //输出的结果 [object Object]---name---ascending
            },
            handleDelete(index, row) {
                this.idx = index;
                this.msg = row;       //每一条数据的记录
                this.delarr.push(this.msg.PackingId); //把单行删除的每条数据的id添加进放删除数据的数组
                this.delVisible = true;
            },
            // 当批量删除的时候,如果要是没有选中,弹出提醒
            delWarnInfo() {
              this.$message('请选择您要删除的数据');
            },
            deleteRow(){
                let _vue = this;
                // 写自己的删除的对象
                // console.log(this.delarr)
                let orders = _vue.list[_vue.idx];
                _vue.api({
                  url: "/order/deleteOrder",
                  method: "post",
                  data: orders
                }).then(() => {
                  if(this.search == ""){
>>>>>>> develop
                    _vue.getList();
                } else {
                    // alert("我怎么就空了呢？")
                    _vue.getListBySearch(this.search);
<<<<<<< HEAD
                }
            }).catch(() => {
                _vue.$message.error("删除失败")
            })
            this.delVisible = false; //关闭删除提示模态框
        },
        //批量删除
        delAll() {
            // alert("我进来啦~");
            var lengths = this.multipleSelection.length;

            for (let i = 0; i < lengths; i++) {
                this.api({
                    url: "/company/deleteCompany",
                    method: "post",
                    data: this.multipleSelection[i]
=======
                  }
                }).catch(() => {
                  _vue.$message.error("删除失败")
                })
                this.delVisible = false;//关闭删除提示模态框
            },
            //批量删除
            delAll() {
                // alert("我进来啦~");
                var lengths = this.multipleSelection.length;
                
                for (let i = 0; i < lengths; i++) {
                  this.api({
                  url: "/order/deleteOrder",
                  method: "post",
                  data: this.multipleSelection[i]
>>>>>>> develop
                }).then(() => {
                    if (this.search == "") {
                        this.getList();
                    } else {
                        this.getListBySearch(this.search);
                    }
                }).catch(() => {
                    this.$message.error("删除失败")
                })

            }
            this.delVisibleByBatch = false; //关闭删除提示模态框
        },
        checkSaleOrders($index, row) {
            // console.log("row：", row);
            // console.log('$index:', $index);
            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;
            // console.log('id:', this.tempOrder.id);
            this.dialogStatus = "check";
            this.dialogFormVisible3 = true;
        },


        designOrders($index, row) {
            // console.log("row：", row);
            // console.log('$index:', $index);
            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;
            // console.log('id:', this.tempOrder.id);
            this.dialogStatus = "design";
            this.dialogFormVisible5 = true;
        },
        designOut(){
            this.temp_design_out.sales_mord_id = "";
            this.temp_design_out.saling_son_order_id = this.tempOrder.id;
            this.temp_design_out.create_staff_id = this.userId;
            this.temp_design_out.status = "待设计";
            console.log('temp_design_out：', this.temp_design_out);
            this.api({
                url: "/order/adddesign",
                method: "post",
                data: this.temp_design_out
            }).then(data => {
                // console.log(data)
                this.dialogFormVisible5 = false;
                this.getList();
                alert("已生成设计订单！", data);
            })
        },
        productOrders($index, row) {
            // console.log('row:', row);
            // console.log('index:', this.list[$index].geneName);
            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;
            this.tempOrder.gene_name = this.list[$index].geneName;
            this.tempOrder.specifications = this.list[$index].specifications;
            this.tempOrder.div_tubes_number = this.list[$index].divTubesNumber;
            this.tempOrder.sense_53 = this.list[$index].sense_53;
            this.tempOrder.antisense_53 = this.list[$index].antisense_53;
            this.tempOrder.chemical_modification = this.list[$index].chemicalModification;
            this.tempOrder.special_modi = this.list[$index].specialModi;
            this.tempOrder.flu_labeling = this.list[$index].fluLabeling;
            this.tempOrder.special_instructions = this.list[$index].specialInstructions;
<<<<<<< HEAD
            // console.log('id:', this.tempOrder.id);
            console.log('tempOrder:', this.tempOrder);
=======
            this.tempOrder.sc_item_id = this.list[$index].sc_item_id;
            this.tempOrder.item_numbers = this.list[$index].item_numbers;
            this.tempOrder.item_unit = this.list[$index].item_unit;
            // console.log('id:', this.tempOrder.id);
>>>>>>> develop
            this.dialogStatus = "product";
            this.dialogFormVisible6 = true;
        },
        productOut(){
            // sales_mord_id : "",
                // saling_son_order_id : "",
                // product_type : "",
                // status : "",
                // gene_name:"",//基因名称 gene_name
                // specifications:"",//规格 synthetic_specification
                // div_tubes_number : "",//分装管数 num_divided_tubes
                // sense_53 : "",//sense53 sense
                // antisense_53 : "", //antisense_53 antisense
                // chemical_modification : "",//化学修饰 chemical_modification
                // special_modi : "",//特殊修饰 special_modification
                // flu_labeling : "" , //荧光标记 fluorescent_labeling
                // special_instructions : "", // 特殊说明 special_instructions
                // create_staff_id : "",
                // product_major_dept_id : "",
            this.temp_product_out.saling_son_order_id = this.tempOrder.id;
            this.temp_product_out.status = "待生产";
            this.temp_product_out.gene_name = this.tempOrder.gene_name;
            this.temp_product_out.specifications = this.tempOrder.specifications;
            this.temp_product_out.div_tubes_number = this.tempOrder.div_tubes_number;
            this.temp_product_out.sense_53 = this.tempOrder.sense_53;
            this.temp_product_out.antisense_53 = this.tempOrder.antisense_53;
            this.temp_product_out.chemical_modification = this.tempOrder.chemical_modification;
            this.temp_product_out.special_modi = this.tempOrder.special_modi;
            this.temp_product_out.flu_labeling = this.tempOrder.flu_labeling;
            this.temp_product_out.special_instructions = this.tempOrder.special_instructions;
            this.temp_product_out.create_staff_id = this.userId;
<<<<<<< HEAD
           console.log('temp_product:', this.temp_product_out);
=======
            this.temp_product_out.sc_item_id = this.tempOrder.sc_item_id;
            this.temp_product_out.item_numbers = this.tempOrder.item_numbers;
            this.temp_product_out.item_unit = this.tempOrder.item_unit;
           console.log('temp_product:', this.temp_product_out);
        //    return;
>>>>>>> develop
           this.api({
                url: "/order/addproduct",
                method: "post",
                data: this.temp_product_out
            }).then(data => {
                // console.log(data)
                this.dialogFormVisible6 = false;
                this.getList();
                alert("已生成生产订单！", data);
            })
<<<<<<< HEAD


=======
>>>>>>> develop
        },
        
        outOrders($index, row) {
            console.log("row：", row);
            // console.log('$index:', $index);
<<<<<<< HEAD
=======
            
>>>>>>> develop
            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;
            this.tempOrder.orderType = this.list[$index].orderType;
<<<<<<< HEAD
            // console.log('id:', this.tempOrder.id);
            console.log('userId：', this.userId);

=======
            this.tempOrder.sc_item_id = this.list[$index].sc_item_id;
            this.tempOrder.item_numbers = this.list[$index].item_numbers;
            this.tempOrder.item_unit = this.list[$index].item_unit;
            // console.log('id:', this.tempOrder.id);
            
>>>>>>> develop
            this.dialogStatus = "out";
            this.dialogFormVisible4 = true;
        },
        exwarehouse() {
            // exwarehouse_son_order_id : "",
            //     type :"",
            //     status :"",
            //     saling_mord_id : "",
            //     saling_son_order_id:"",
            //     storage_put_num_ought:"",
            //     storage_put_num :"",
            //     application_staff_id : "",
            //     product_name :"",
            this.temp_warehouse_out.type = "销售出库";
            this.temp_warehouse_out.status = "待出库";
            // this.temp_warehouse_out.saling_mord_id = this.tempOrder.mord_id;
            this.temp_warehouse_out.saling_son_order_id = this.tempOrder.id;
<<<<<<< HEAD
            this.temp_warehouse_out.storage_put_num_ought = "1";
            this.temp_warehouse_out.storage_put_num = "1";
            this.temp_warehouse_out.application_staff_id = this.userId;
            this.temp_warehouse_out.product_name = this.tempOrder.orderType;
            console.log('warehouse', this.temp_warehouse_out);
=======
            this.temp_warehouse_out.storage_put_num_ought = this.tempOrder.item_numbers;
            this.temp_warehouse_out.storage_put_num = this.tempOrder.item_numbers;
            this.temp_warehouse_out.application_staff_id = this.userId;
            this.temp_warehouse_out.product_name = this.tempOrder.orderType;
            this.temp_warehouse_out.sc_item_id = this.tempOrder.sc_item_id;
            this.temp_warehouse_out.unit = this.tempOrder.item_unit;
            console.log('warehouse', this.temp_warehouse_out);
            // return;
>>>>>>> develop
            this.api({
                url: "/order/addexwarehouse",
                method: "post",
                data: this.temp_warehouse_out
            }).then(data => {
                // console.log(data)
                this.dialogFormVisible4 = false;
                this.getList();
                alert("已生成出库订单并出库成功！", data);
            })
        },
        checkSub() {
            this.tempOrder.radio2 = this.radio2;
            this.tempOrder.textarea2 = this.textarea2;
            console.log("tempOrder:", this.tempOrder);
            this.api({
                url: "/order/checkSub",
                method: "post",
                data: this.tempOrder
            }).then(data => {
                // console.log(data)
                this.dialogFormVisible3 = false;
                this.getList();
                alert("审核成功！", data);
            })
        },
        getAllDepartments() {
        //获取部门列表
        this.api({
          url: "/department/listDepartment",
          method: "get"
        }).then(data => {
          //this.departmentList = data.list;
          this.departmentList = data.list;
          console.log(this.departmentList.length);
          console.log('departments:', this.departmentList);
        })
      },

        toggleSelection(rows) {
            if (rows) {
                rows.forEach(row => {
                    this.$refs.multipleTable.toggleRowSelection(row);
                });
            } else {
                this.$refs.multipleTable.clearSelection();
            }
        },
        delSelect() {
            const length = this.multipleSelection.length;
            if (length == 0) {
                this.delWarnInfo();
            } else {
                this.delVisibleByBatch = true; //显示删除弹框
            }
            // this.delAll();
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex % 2 === 1) {
                return 'warning-row';
            } else if (rowIndex % 2 === 0) {
                // return 'success-row';
            }
            return '';
        },

        getList() {
            //查询所有的订单信息
            if (!this.hasPerm('order:list')) {
                return
            }
            this.listLoading = true;
            this.api({
                url: "/order/listOrder",
                method: "get",
                params: this.listQuery
            }).then(data => {
<<<<<<< HEAD
                console.log("data:", data);
=======
>>>>>>> develop
                this.listLoading = false;
                this.list = data.list;
                this.tables = data.list;
                this.totalCount = data.totalCount;
            })
        },
        getListByOrderContent() {
            //升序或降序查询岗位信息

            if (!this.hasPerm('article:list')) {
                return
            }
            this.listLoading = true;
            this.api({
                url: "/article/listArticleByOrder",
                method: "get",
                params: this.listQuery
            }).then(data => {
                // console.log('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
                // console.log(data)
                this.listLoading = false;
                this.list = data.list;
                this.tables = data.list;
                this.totalCount = data.totalCount;
            })
        },

        // 当搜索框中有内容的时候，排序的时候需要只排序搜索出来的内容
        getListByContentHaveSearch() {
            //查询列表

            if (!this.hasPerm('article:list')) {
                return
            }
            this.listLoading = true;
            this.listQuery.value = this.search;
            this.api({
                url: "/article/listArticleByContentHaveSearch",
                method: "get",
                params: this.listQuery
            }).then(data => {
                console.log(data)
                this.listLoading = false;
                this.list = data.list;
                this.tables = data.list;
                this.totalCount = data.totalCount;
            })
        },

        getListByOrderCreateTimeHaveSearch() {
            //查询列表

            if (!this.hasPerm('article:list')) {
                return
            }
            this.listLoading = true;
            this.listQuery.value = this.search;
            this.api({
                url: "/article/getListByOrderCreateTimeHaveSearch",
                method: "get",
                params: this.listQuery
            }).then(data => {
                console.log(data)
                this.listLoading = false;
                this.list = data.list;
                this.tables = data.list;
                this.totalCount = data.totalCount;
            })
        },
        getListByOrderCreateTime() {
            //查询列表

            if (!this.hasPerm('article:list')) {
                return
            }
            this.listLoading = true;
            this.api({
                url: "/article/listArticleByOrderCreateTime",
                method: "get",
                params: this.listQuery
            }).then(data => {
                // console.log(data)
                this.listLoading = false;
                this.list = data.list;
                this.tables = data.list;
                this.totalCount = data.totalCount;
            })
        },

        getListBySearch(val) {
            // console.log("val:"+val);
            //查询列表
            if (!this.hasPerm('company:list')) {
                return
            }
            this.listLoading = true;
            this.listQuery.value = val;
            // console.log("this.listQuery" + this.listQuery);
            this.api({
                url: "/company/listCompanyBySearch",
                method: "get",
                params: this.listQuery
            }).then(data => {
                // console.log(data)
                this.listLoading = false;
                this.list = data.list;
                this.totalCount = data.totalCount;
            })
        },
        handleSizeChange(val) {
            //改变每页数量
            // alert("handleSizeChange()")
            this.listQuery.pageRow = val
            this.generalFun();
            // this.handleFilter();
        },
        handleCurrentChange(val) {
            //改变页码
            // console.log("sortby:",this.listQuery.sortby)
            // console.log("order:",this.listQuery.order)
            this.listQuery.pageNum = val
            this.generalFun();

        },
        getIndex($index) {
            //表格序号
            return (this.listQuery.pageNum - 1) * this.listQuery.pageRow + $index + 1
        },
        showCreate() {
            //显示新增对话框
            this.tempOrder.id = "";
            this.tempOrder.order_id = "";
            this.tempOrder.mord_id = "";
            this.tempOrder.create_time = "";
            this.tempOrder.client_name = "";
            this.tempOrder.manager_name = "";
            this.tempOrder.client_affiliation = "";
            this.tempOrder.shipping_address = "";
            this.tempOrder.invoice_title = "";
            this.tempOrder.form_of_invoice = "";
            this.tempOrder.telephone = "";
            this.tempOrder.client_phone = "";
            this.tempOrder.client_email = "";
            this.tempOrder.notification_of_delivery = "";
            this.dialogStatus = "create";
            this.dialogFormVisible = true
        },
        showDisplay() {
            this.dialogStatus = "dispalyAtt"
            this.dialogFormVisible = true
        },
        showDetails($index) {
<<<<<<< HEAD

            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;

            this.dialogStatus = "detail"
            this.dialogFormVisible2 = true
=======
            // this.tempOrder.order_id = this.list[$index].order_id;
            this.tempOrder = this.list[$index];
            var routers = ''

            this.api({
                url: "/order/getOrderTypeByID",
                method: "get",
                params: this.tempOrder
            }).then(data => {
                if (data.order_type === 'RNA oligo'){
                    routers = '/order/order/RNA_oligo'
                }else if(data.order_type === '试剂盒&引物探针套装'){
                    routers = '/order/order/Kit_Probe'
                }else if(data.order_type === '载体'){
                    routers = '/order/order/Carrier'
                }else if(data.order_type === '探针合成'){
                    routers = '/order/order/DNAProbe'
                }else if(data.order_type === 'FISH试剂盒&其它'){
                    routers = '/order/order/FISH_Kit'
                }else if(data.order_type === '病毒'){
                    routers = '/order/order/Virus'
                }else if(data.order_type === '全基因'){
                    routers = '/order/order/Whole_gene'
                }

                let order = this.list[$index];
                order.orderOperate = 'showDetails';
                
                this.$store.dispatch('SetOrderId', order).then(data => {
                    if ("success" === data) {
                        this.$router.push({ path: routers });
                        this.dialogProjectFormVisible = true;
                        // this.listLoading = true;
                    } else {
                        this.$message.error("发生错误！！！！");
                    }
                }).catch(() => {
                    this.listLoading = false
                })
            })

>>>>>>> develop
        },
        showUpdate($index) {
            //显示修改对话框

<<<<<<< HEAD
            //绑定相应的id
            this.tempOrder.id = this.list[$index].order_id;
            this.tempOrder.create_time = this.list[$index].create_time;
            this.tempOrder.client_name = this.list[$index].client_name;
            this.tempOrder.manager_name = this.list[$index].manager_name;
            this.tempOrder.client_affiliation = this.list[$index].client_affiliation;
            this.tempOrder.shipping_address = this.list[$index].shipping_address;
            this.tempOrder.invoice_title = this.list[$index].invoice_title;
            this.tempOrder.form_of_invoice = this.list[$index].form_of_invoice;
            this.tempOrder.telephone = this.list[$index].telephone;
            this.tempOrder.client_phone = this.list[$index].client_phone;
            this.tempOrder.client_email = this.list[$index].client_email;
            this.tempOrder.notification_of_delivery = this.list[$index].notification_of_delivery;

            this.dialogStatus = "update"
            this.dialogFormVisible = true
        },

        handlerOrderType() {
            if (this.label != '') {
=======
            this.tempOrder = this.list[$index];
            var routers = ''

            this.api({
                url: "/order/getOrderTypeByID",
                method: "get",
                params: this.tempOrder
            }).then(data => {
                if (data.order_type === 'RNA oligo'){
                    routers = '/order/order/RNA_oligo'
                }else if(data.order_type === '试剂盒&引物探针套装'){
                    routers = '/order/order/Kit_Probe'
                }else if(data.order_type === '载体'){
                    routers = '/order/order/Carrier'
                }else if(data.order_type === '探针合成'){
                    routers = '/order/order/DNAProbe'
                }else if(data.order_type === 'FISH试剂盒&其它'){
                    routers = '/order/order/FISH_Kit'
                }else if(data.order_type === '病毒'){
                    routers = '/order/order/Virus'
                }else if(data.order_type === '全基因'){
                    routers = '/order/order/Whole_gene'
                }

                let order = this.list[$index];
                order.orderOperate = 'showUpdate';
                
                this.$store.dispatch('SetOrderId', order).then(data => {
                    if ("success" === data) {
                        this.$router.push({ path: routers });
                        this.dialogProjectFormVisible = true;
                        this.listLoading = true;
                    } else {
                        this.$message.error("发生错误！！！！");
                    }
                }).catch(() => {
                    this.listLoading = false
                })

            })
        },

        handlerOrderType() {
            if (this.lable_type != '') {
>>>>>>> develop
                this.enableCreate = false;
            }
        },

        createOrder() {
<<<<<<< HEAD
            console.log("页面跳转")
            console.log(this.label)
            var routers = ''

            if (this.label === '选项1') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项2') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项3') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项4') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项5') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项6') {
                routers = '/order/order/RNA_oligo'
            } else if (this.label === '选项7') {
                routers = '/order/order/RNA_oligo'
            }

            this.$router.push({ path: routers });
            this.dialogProjectFormVisible = true;
            this.listLoading = true;
        },

        updateCompany() {
=======
            var routers = ''

            if(this.lable_type === '选项1'){
              routers = '/order/order/RNA_oligo'
            }else if(this.lable_type === '选项2'){
              routers = '/order/order/Kit_Probe'
            }else if(this.lable_type === '选项3'){
              routers = '/order/order/Carrier'
            }else if(this.lable_type === '选项4'){
              routers = '/order/order/DNAProbe'
            }else if(this.lable_type === '选项5'){
              routers = '/order/order/FISH_Kit'
            }else if(this.lable_type === '选项6'){
              routers = '/order/order/Virus'
            }else if(this.lable_type === '选项7'){
              routers = '/order/order/Whole_gene'
            }

            let order = [];
            order.order_id = '';
            order.orderOperate = 'createOrder';
            
            this.$store.dispatch('SetOrderId', order).then(data => {
                if ("success" === data) {
                    this.$router.push({ path: routers });
                    this.dialogFormVisible = false;
                    this.dialogProjectFormVisible = true;
                    this.listLoading = true;
                } else {
                    this.$message.error("发生错误！！！！");
                }
            }).catch(() => {
                this.listLoading = false
            })
        },

        updateOrder() {
>>>>>>> develop
            // console.log("tempPosition:"+this.tempPosition);
            //修改岗位信息
            this.api({
                url: "/company/updateCompany",
                method: "post",
                data: this.tempOrder
            }).then(() => {
                this.getList();
                this.dialogFormVisible = false
            })
        },

        generalFun() {
            if (this.search) {
                if (this.listQuery.sortby == "" & this.listQuery.order == "") {
                    this.getListBySearch(this.search);
                } else if (this.listQuery.sortby == "content" && this.listQuery.order == "ASC") {
                    // alert("你好啊")
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "ASC";
                    this.getListByContentHaveSearch();
                } else if (this.listQuery.sortby == "content" && this.listQuery.order == "DESC") {
                    // alert("很好啊")
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "DESC";
                    this.getListByContentHaveSearch();
                } else if (this.listQuery.sortby == "createTime" && this.listQuery.order == "ASC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "ASC";
                    this.getListByOrderCreateTimeHaveSearch();
                } else if (this.listQuery.sortby == "createTime" && this.listQuery.order == "DESC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "DESC";
                    this.getListByOrderCreateTimeHaveSearch();
                } else {
                    // ...
                }
            }
            // 没有搜索内容，所以可以直接
            else {
                // alert("ssssssssssssssssss")
                // console.log(this.prop);
                // console.log(this.order);
                if (this.listQuery.sortby == "" & this.listQuery.order == "") {

                    this.getList();
                } else if (this.listQuery.sortby == "content" && this.listQuery.order == "ASC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "ASC";
                    // ...
                    this.getListByOrderContent();
                } else if (this.listQuery.sortby == "content" && this.listQuery.order == "DESC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "DESC";
                    this.getListByOrderContent();
                } else if (this.listQuery.sortby == "createTime" && this.listQuery.order == "ASC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "ASC";
                    this.getListByOrderCreateTime();
                } else if (this.listQuery.sortby == "createTime" && this.listQuery.order == "DESC") {
                    // this.listQuery.sortby = this.prop;
                    // this.listQuery.order = "DESC";
                    this.getListByOrderCreateTime();
                } else {
                    // ...
                    this.getList();
                    // alert("我是空的！")
                }
            }
        }
    }

}
</script>


<style>
.el-table .warning-row {
    background: whitesmoke;
    /* background: #ffffff; */
}

.el-table .success-row {
    background: #f0f9eb;
}

.pagination {
    background-color: lavender;
    margin-right: 0%;
    text-align: right;
}

.searchWord .add1 {
    display: inline;
}

#btn {
    /* padding: 5px 10px;
            background: #00b0f0;
            color: #FFF;
            border: none;
            border-radius: 5px; */
}
</style>